#!/usr/bin/env escript

main(_) ->
  io:format("Number of primes ~p\n", [prime_count(114)]).

prime_count(2) -> 1;
prime_count(N) -> 
  is_prime(N) + prime_count(N-1).

is_prime(N) ->
  DivisibleList = [X || X <- lists:seq(2,N-1), N rem X =:= 0],
  if 
	  length(DivisibleList) > 0 -> 0;
	  true -> 1
  end.
																	